package com.leader.say.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.leader.say.dao.UserMapper;
import com.leader.say.entity.User;
import com.leader.say.query.UserQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {


    @Autowired
    UserMapper userDao;

    @Override
    public Page<User> findByPage(UserQuery query, int pageNo, int pageSize) {
        PageHelper.startPage(pageNo, pageSize);
        return userDao.findByPage(query);
    }

    @Override
    public List<User> userList() {
        return userDao.selectAllUser();
    }

    @Override
    public int insert(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public int delete(int id) {
        return 0;
    }

    @Override
    public User findByName(String name) {
        return null;
    }

}
